package Interface.Producao.Inco;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
import sft.BancodeDados.CriaConexao;
import sft.Logica.Producao;

public class ProducaoUploadDao {

    private Connection conexao;

    public ProducaoUploadDao() throws SQLException {
        if (conexao == null) {
            conexao = new CriaConexao().getConnection();
        }
    }

    public void adiciona(Producao l) throws SQLException {

        String sql = "INSERT INTO sft.sft_inco ("
                + "fk_usua, fk_ncon, fk_conv, fk_unid, fk_aten, "
                + "inco_os_numos, inco_dt_dtregis, inco_ob_obsinco, inco_st_status)"
                + " VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)";

        try (PreparedStatement stmt = conexao.prepareStatement(sql)) {
            stmt.setInt(1, l.getUsuario());
            stmt.setInt(2, l.getnConformidade());
            stmt.setInt(3, l.getConvenio());
            stmt.setInt(4, l.getUnidade());
            stmt.setInt(5, l.getAtendente());
            stmt.setString(6, l.getOS());
            stmt.setDate(7, l.getData());
            stmt.setString(8, l.getObs());
            stmt.setString(9, l.getStatus());

            stmt.execute();
        }
        
        conexao.close();
    }
}
